<div class="account-form">
    <fieldset>
        <?php echo $this->Form->create( "Stage",array("type"=>"post") ); ?>
        <div class="form-group"><?php echo $this->Form->input( "name", array(
                "label" => "Nume",
                "class" => "form-control",
                'value' => $stage['Stage']['name'],
                "pattern" => "[a-zA-Z0-9 ]{4,}"
            ) ); ?></div>
        <div class="form-group"><?php echo $this->Form->input( "description", array(
                "label" => "Descriere",
                "class" => "form-control",
                'value' => $stage['Stage']['description'],
                "pattern" => "[a-zA-Z0-9 ]{10,}"
            ) ); ?></div>
        <div class="form-group"><?php echo $this->Form->input( "limit_date", array(
                "type" => 'text',
                "label" => "Data limita",
                "class" => "form-control datepicker",
                'value' => $stage['Stage']['limit_date']
            ) ); ?></div>
            
        <div class="added_tasks">
            <?php
                $i=0;
                foreach($tasks as $task)
                {
                    echo '
            <div class="requirement_add_form req'.$task['Task']['id'].'"><h1>Task '.($i+1).' <a onclick="DeleteTask('.$task['Task']['id'].')">Sterge</a></h1>
                <div class="form-group"><div class="input text"><label for="Task'.$i.'Name">Nume</label><input name="data[Task'.$i.'][name]" class="form-control" type="text" id="Task'.$i.'Name" value="'.$task['Task']['name'].'"></div></div>
                
            </div>';
                    $i++;
                }
                echo '<script>var task_nr='.$i.';</script>';
            ?>

        </div>
        <div class="add_req_button" onclick="AddTask()">+ Adauga Task</div>

        <?php echo $this->Form->end( array(
                                         "label" => "Adaugare",
                                         "class" => "btn"
                                     ) ); ?>
    </fieldset>
</div>